<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>彩种赔率设置</title>
  <%@include file="/WEB-INF/base.jspf"%>
  <style type="text/css">
  	.div-c-tabOneLevel, .div-c-tabTwoLevel {
  		display:flex;
  		align-items:center;
  		flex-wrap:wrap;
  		padding-bottom:16px;
  	}
	.modal-dialog {
		max-width: 1000px;
	}  	
  	.span-c-wanfaItem {
  		color:#337ab7;
  		border-radius:4px;
  		display:block;
  		padding:10px 15px;
  		cursor: pointer;
  	}
  	.span-c-wanfaItem:hover {
  		background-color: #eee;
  	}
  	.span-c-wanfaItem-active:hover {
  		background-color:#337ab7;
  		color:#fff;  		
  	}
  	.span-c-wanfaItem-active {
  		background-color:#337ab7;
  		color:#fff;
  	}
  	.div-c-tabTwoLevel {
  		display:none;
  	}
  	.div-c-tabTwoLevel-active {
  		display:flex;
  	}
  	[data-caizhongname="klpk"], [data-caizhongname="bjl"], [data-caizhongname="bj28"], [data-caizhongname="xy28"] {
  		display:none;
  	}
  	.td-c-peilvAndBtn > div {
  		display:flex;
  		justify-content:center;
  	}
  	.td-c-peilvAndBtn > div > button {
  		margin-left:16px;
  	}
  	.td-c-peilvAndBtn > div > .form-control {
  	width:150px;}
  	.div-c-wanfaDataDiv td {
  		vertical-align: middle!important;
  		text-align: center;
  	}
  	.div-c-wanfaDataDiv th {
  		text-align: center;
  	}
  	.td-c-haomaValue {
  		color:red;
  	}
  </style>
</head>
<body>
	<div id="main">
		<div class="div-c-tabOneLevel">
			<c:forEach items="${lottery}" var="lottery">
				<span class="span-c-wanfaItem" data-caizhongName="${lottery.cname}" data-caizhongid="${lottery.id}">${lottery.name}</span>
			</c:forEach>	
		</div>
		<div class='lotterData'>
			
		</div>
	 				
		<div style="display:flex;justify-content:flex-end;">
			<button class='btn btn-default btn-save-peilv btn-lg'style="margin-bottom:10px;">保存</button>	
		</div>
		<table class="div-c-wanfaDataDiv table table-striped table-bordered table-hover">
			<thead>
				<tr>
				</tr>
			</thead>
			<tbody>
				<tr></tr>
			</tbody>
		</table>																									
	</div> 
	
<!-- 提醒模态框（Modal） -->

<div class="modal fade" id="noticeModal" tabindex="-1" role="dialog" aria-labelledby="noticeModal" aria-hidden="true">
    <div class="modal-dialog class-fake-alert">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body" ></div>
            <div class="modal-footer">	      
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>   		
	
<script>
$(".div-c-tabOneLevel span:first-child").addClass("span-c-wanfaItem-active")
  $.post('/czgl/findSameTypeLottery.do',{},function(data){
	$(".lotterData").empty();
	var newData=data.data;
	var html=""
	for(i=0;i<newData.length;i++){
		var item=newData[i];
		if(item.zoushitu==1){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
				"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='gyhz1' data-myindex='1'>冠亚和值</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='gj2' data-myindex='2'>冠　军</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='gj2' data-myindex='2'>亚　军</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='gj2' data-myindex='2'>第三名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='gj2' data-myindex='2'>第四名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='gj2' data-myindex='2'>第五名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='d6m7' data-myindex='2'>第六名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='d6m7' data-myindex='2'>第七名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='d6m7' data-myindex='2'>第八名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='d6m7' data-myindex='2'>第九名</span>"+
				"<span class='span-c-wanfaItem' data-wanfatype='d6m7' data-myindex='2'>第十名</span>"+		
			"</div>"
		}else if(item.zoushitu==2){
			html+="<div class='div-c-tabTwoLevel'  id='tabTwo-"+item.cname+"'>"+
					"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='zh12'>总　和</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='d1q13'>第一球</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='d1q13'>第二球</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='d1q13'>第三球</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='d1q13'>第四球</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='d1q13'>第五球</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='q318'>前　三</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='q318'>中　三</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='q318'>后　三</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm1'>前二直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm2'>后二直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm3'>前三直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm4'>中三直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm5'>后三直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm6'>前二组选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm7'>后二直选</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm8'>前三组六</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm9'>中三组六</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm10'>后三组六</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm11'>前三组三</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm12'>中三组三</span>"+
					"<span class='span-c-wanfaItem' data-wanfatype='lm13'>后三组三</span>"+
				"</div>"
		}else if(item.zoushitu==3){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem  span-c-wanfaItem-active' data-wanfatype='hunhe28'>混合</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='tema28'>特码</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='tmb328'>特码包三</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='bs28'>波色</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='bz28'>豹子</span>"+
		"</div>"
		}else if(item.zoushitu==4){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem  span-c-wanfaItem-active' data-wanfatype='sxstgd'>首位数投</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='sxttgd'>首位红投</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='elzx36'>二连直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='elzx37'>二连组选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='q3zx38'>前三直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='q3zx39'>前三组选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kl240'>快乐二</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kl3341'>快乐三</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kl442'>快乐四</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kl543'>快乐五</span>"+
		"</div>"
		}else if(item.zoushitu==5){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='ah11xuan5d1q44' >第一球</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ah11xuan5d1q44'>第二球</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ah11xuan5d1q44'>第三球</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ah11xuan5d1q44'>第四球</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ah11xuan5d1q44'>第五球</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='gyhz1'>总　和</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ah11xuan5bzwf50'>前一直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='lm1'>前二直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='q3zx38'>前三直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='renxuanyi444'>任选一</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan2444'>任选二</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan3444'>任选三</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan4444'>任选四</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan5444'>任选五</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan6444'>任选六</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan7444'>任选七</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ruanxuan8444'>任选八</span>"+
		"</div>"
		}else if(item.zoushitu==6){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='temaa51'>特码A</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temaa51'>特码B</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>特码生肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='gyhz1'>大小单双</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='jqys55'>家禽野兽</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ts56'>头数</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ws57'>尾数</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='wx68'>五行</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='gyhz1'>总和</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='gyhz1'>合数</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temaa51'>独平</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pm72'>平二中二</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pm88'>平三中三</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pm98'>平三中二</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>四肖中特</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>五肖中特</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>六肖中特</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>平特一肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>平特二肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>平特三肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='temashenxiao53'>平特四肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pingteyixiao1'>平特一尾</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pingteyixiao1'>平特二尾</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pingteyixiao1'>平特三尾</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='pingteyixiao1'>平特四尾</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz765'>5不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz766'>6不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz767'>7不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz768'>8不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz769'>9不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7610'>10不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7611'>11不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7612'>12不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7613'>13不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7614'>14不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='ptbz7615'>15不中</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='zx77'>总肖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='sb78'>色波</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='bb79'>半波</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='bbb80'>半半波</span>"+
		"</div>"
		}else if(item.zoushitu==7){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='shssl81'>前二直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl82'>前二组选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl83'>后二直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl84'>后二组选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl85'>三星直选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl86'>三星和值</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl87'>三星组三</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl88'>组三和值</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl89'>三星组六</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='shssl810'>组六和值</span>"+
		"</div>"
		}else if(item.zoushitu==8){
			html+="<div class='div-c-tabTwoLevel' id='tabTwo-"+item.cname+"'>"+
			"<span class='span-c-wanfaItem span-c-wanfaItem-active' data-wanfatype='kuai3caiyigehao82'>猜一个号</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao89'>三连号通选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao90'>二同号复选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao91'>二同号单选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao92'>二不同号</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao93'>二不同号胆拖</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao94'>三同号通选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao95'>三同号单选</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='kuai3caiyigehao96'>三不同号</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='xingtai97'>形态</span>"+
			"<span class='span-c-wanfaItem' data-wanfatype='zonghe98'>总和</span>"+
		"</div>"
		}
	}
	$(".lotterData").append(html)
	$(".lotterData .div-c-tabTwoLevel").eq(0).addClass("div-c-tabTwoLevel-active")
	bindAllSpanTabEvent()
	getPeiLvFromServer()
	bindSaveBtn()
})




		/*彩种玩法的属性*/
  		var WANFA_OBJ = {
			"gyhz1": ["单",'双', "大",'小',],
			"gj2": ["单",'双', "大",'小',"龙","虎","01","02","03","04","05","06","07","08","09","10"],
			"d6m7": ["单",'双', "大",'小',"01","02","03","04","05","06","07","08","09","10"],
			"zh12": ["单",'双', "大",'小',"龙","虎","和"],
			"d1q13": ["单",'双', "大",'小',"00","01","02","03","04","05","06","07","08","09",],
			"q318": ["豹子", "顺子", "对子", "半顺", "杂六"],
			"lm1": ["前二直选"],
			"lm2": ["后二直选"],
			"lm3": ["前三直选"],
			"lm4": ["中三直选"],
			"lm5": ["后三直选"],
			"lm6": ["前二组选"],
			"lm7": ["后二组选"],
			"lm8": ["前三组六"],
			"lm9": ["中三组六"],
			"lm10": ["后三组六"],
			"lm11": ["前三组三"],
			"lm12": ["中三组三"],
			"lm13": ["后三组三"],
			"sxstgd": ["01","02","03","04","05","06","07","08","09","10", "11", "12", "13", "14", "15", "16", "17", "18", ],
			"sxttgd": ["19", "20"],
			"elzx36": ["二连直选"],
			"elzx37": ["二连组选"],
			"q3zx38": ["前三直选"],
			"q3zx39": ["前三组选"],
			"kl240": ["快乐二"],
			"kl3341": ["快乐三"],
			"kl442": ["快乐四"],
			"kl543": ["快乐五"],	
			"ah11xuan5d1q44": ["单",'双', "大",'小', "01","02","03","04","05","06","07","08","09","10", "11",],
			"ah11xuan5bzwf50": ["01","02","03","04","05","06","07","08","09","10", "11",],
			"renxuanyi444": ["01","02","03","04","05","06","07","08","09","10", "11",],
			"ruanxuan2444": ["任选二"],
			"ruanxuan3444": ["任选三"],
			"ruanxuan4444": ["任选四"],
			"ruanxuan5444": ["任选五"],
			"ruanxuan6444": ["任选六"],
			"ruanxuan7444": ["任选七"],
			"ruanxuan8444": ["任选八"],
			"temaa51": ["01","02","03","04","05","06","07","08","09","10", "11", "12", "13", "14", "15", "16", "17", "18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49"],
			"temashenxiao53":["鼠", "牛", "虎", "兔","龙","蛇","马","羊","猴","鸡","狗","猪"],
			"jqys55": ["家肖","野肖","天肖","地肖"],
			"ts56": ["0头", "1头", "2头", "3头", "4头"],
			"ws57": ["0尾", "1尾", "2尾","3尾","4尾","5尾","6尾","7尾","8尾","9尾","大","小","单","双"],
			"wx68": ["金","木","水","火","土"],
			"pm72": ["平二中二"],
			"pm88": ["平三中三"],
			"pm98": ["平三中二"],
			"dxzt732": ["四肖中特"],
			"dxzt733": ["五肖中特"],
			"dxzt734": ["六肖中特"],
			"pingteyixiao1": ["00","01","02","03","04","05","06","07","08","09"],
			"ptbz765":["5不中"],
			"ptbz766":["6不中"],
			"ptbz767":["7不中"],
			"ptbz768":["8不中"],
			"ptbz769":["9不中"],
			"ptbz7610":["10不中"],
			"ptbz7611":["11不中"],
			"ptbz7612":["12不中"],
			"ptbz7613":["13不中"],
			"ptbz7614":["14不中"],
			"ptbz7615":["15不中"],
			"zx77": ["2肖", "3肖", "4肖", "5肖", "6肖", "7肖", "单", "双"],
			"sb78": ["红波", "蓝波", "绿波"],
			"bb79": ["红大", "红小", "红单", "红双", "蓝大", "蓝小", "蓝单", "蓝双", "绿大", "绿小", "绿单", "绿双"],
			"bbb80": ["红大单", "红大双", "红小单", "红小双", "蓝大单", "蓝大双", "蓝小单", "蓝小双", "绿大单", "绿大双", "绿小单", "绿小双"],
			"shssl81": ["前二直选",],
			"shssl82": ["前二组选",],
			"shssl83": ["后二直选",],
			"shssl84": ["后二组选",],
			"shssl85": ["三星直选",],
			"shssl86": [ "三星和值",],
			"shssl87": [ "三星组三",],
			"shssl88": ["组三和值",],
			"shssl89": [ "三星组六", ],
			"shssl810": ["组六和值"],
			"kuai3caiyigehao82": ["猜一个号-豹子","猜一个号-对子","猜一个号-杂六",],
			"kuai3caiyigehao89": ["三连号通选"],
			"kuai3caiyigehao90": ["11","22","33","44","55","66",],
			"kuai3caiyigehao91": ["二同号单选",],
			"kuai3caiyigehao92": [ "二不同号",],
			"kuai3caiyigehao93": ["二不同号胆拖",],
			"kuai3caiyigehao94": ["三同号通选",],
			"kuai3caiyigehao95": ["111","222","333","444","555","666"],
			"kuai3caiyigehao96": ["三不同号",],
			"xingtai97":["豹子", "顺子", "对子", "半顺", "杂六"],
			"zonghe98":["03","04","05","06","07","08","09","10", "11", "12", "13", "14", "15", "16", "17", "18","大","小","单","双"],
			"hunhe28":["大","小","单","双","大单","大双","小单","小双", "极大", "极小"],
			"tema28":["0","1","2","3","4","5","6","7", "8", "9", "10", "11", "12", "13", "14", "15","16","17","18","19","20","21","22","23","24","25","26","27"],
			"tmb328":["0","1","2","3","4","5","6","7", "8", "9", "10", "11", "12", "13", "14", "15","16","17","18","19","20","21","22","23","24","25","26","27"],
			"bs28":["红波","绿波","蓝波"],
			"bz28":["豹子"],
	}
	
 	var bindAllSpanTabEvent = function() {
		$(".div-c-tabOneLevel span:first-child").addClass("span-c-wanfaItem-active")
		$("#main").on("click",".span-c-wanfaItem", function(event) {
			var item = $(event.target)
			item.parent().find(".span-c-wanfaItem-active").removeClass("span-c-wanfaItem-active")
			item.addClass("span-c-wanfaItem-active")
			if (item.parent().hasClass("div-c-tabOneLevel")) {
				$(".div-c-tabTwoLevel-active").removeClass("div-c-tabTwoLevel-active")
				var wanfaName = item[0].dataset.caizhongname
				console.log(wanfaName)
				$("#tabTwo-" + wanfaName).addClass("div-c-tabTwoLevel-active")
			}
			getPeiLvFromServer()
		})
	}

	var getPeiLvFromServer = function() {
		var urlPath ="/czgl/findByIdLotteryInfo.do"
			var newRequest = {
				url: urlPath,
				type: "post",
				data: {
					id: $(".div-c-tabOneLevel .span-c-wanfaItem-active")[0].dataset.caizhongid,
				},
				success: function(data) {
					var newData = JSON.parse(data)
					 var index = $(".div-c-tabTwoLevel-active .span-c-wanfaItem-active").index() + 1
					 console.log(index,newData.data)
					$(".div-c-wanfaDataDiv")[0].dataset.rebate = index
					
					var dataArray = newData.data["rebate" + index]
					console.log(dataArray,'dataArray的值')
					 createTable(dataArray)  
				},
				error: function(status) {
					console.log("status", status)
				}
			}
			ajax(newRequest)			
	}
	
	var resetTable = function() {
		var html = "<thead><tr></tr></thead><tbody><tr></tr></tbody>"
		$(".div-c-wanfaDataDiv").html(html)
	}
	
	var createTable = function(dataArray) {
		resetTable()
		var newArray = dataArray.split(",")
		var wanfaName = $(".div-c-tabTwoLevel-active .span-c-wanfaItem-active")[0].dataset.wanfatype
		console.log(wanfaName)
		var wanfaArray = WANFA_OBJ[wanfaName]
		console.log(wanfaArray)
		//画表头
		//
		var index
		if (wanfaArray.length <= 4) {
			index = wanfaArray.length
		} else {
			index = 4
		}
		var $Tr = $(".div-c-wanfaDataDiv thead").find("tr")
		for (var i = 0; i < index; i++) {
			var html = "<th>号码</th><th>赔率</th>"
			$Tr.append(html)
		}
		//["单",'双', "大",'小',],
		for (var j = 1; j <= wanfaArray.length; j++) {
			var item = wanfaArray[j - 1]
			var html = "<td class='td-c-haomaValue'>" + item + "</td><td class='td-c-peilvAndBtn'><div><input class='form-control input-c-peilvValue' value='" + newArray[j - 1] + "' /></div></td>"
			var $lastTr = $(".div-c-wanfaDataDiv tbody tr:last-child")
			$lastTr.append(html)
			if (j % 4 == 0) {
				$(".div-c-wanfaDataDiv tbody").append("<tr></tr>")
			}
		}
	}
	
	var bindSaveBtn = function() {
		$(".btn-save-peilv").on("click", function(event) {
			var $Self = $(event.currentTarget)
			var result = ""
			var flag = true
			var allInputs = document.querySelectorAll(".input-c-peilvValue")
			for (var i = 0; i < allInputs.length; i++) {
				var item = allInputs[i]
				if (!isCurrentNumber(item.value)) {
					flag = false
					break
				}
			}
			if (!flag) {
				showNoticeModal('赔率数字有误')
				return
			}
			$(".input-c-peilvValue").each(function(index, element) {
				var value = parseFloat(element.value)
				value = Math.round(value * 100) / 100
				result += value + ","
			})
			var urlPath = "/czgl/updateLotteryRatio.do"
				var newRequest = {
					url: urlPath,
					type: "post",
					data: {
						id: $(".span-c-wanfaItem-active")[0].dataset.caizhongid,
						name: $(".div-c-tabOneLevel .span-c-wanfaItem-active").text(),
						play: $(".div-c-tabTwoLevel-active .span-c-wanfaItem-active").text(),
						rename: "rebate" + $(".div-c-wanfaDataDiv")[0].dataset.rebate,
						rebate1: result
					},
					success: function(data) {
						showNoticeModal("保存成功")
						getPeiLvFromServer()
					},
					error: function(status) {
						console.log("status", status)
						}
					}
			ajax(newRequest)				
		})
	}
	
</script> 
</body>
</html>